<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Source: services/AnniversaryService.js</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Source: services/AnniversaryService.js</h1>

    



    
    <section>
        <article>
            <pre class="prettyprint source linenums"><code>/** 
 * 纪念日相关服务
 * @module
 * @requires scripts/scommon
 */

import ajax from 'scripts/common'

//模拟ajax，测试用，开发后删除
function mockAjax(option,data,time){
	var call=function(fun){
		setTimeout(()=>{
			fun&amp;&amp;fun(data)
		},typeof time=='undefined'?1000:time)
		return this
	}
	call(option?option.complete:null)
	call(option?option.success:null)
	return {
		then:call,
		complete:call,
		done:call,
		error:function() { return this }
	}
}

/**
 * 默认导出
 * @type {Object}
 * @property {Function} init 初始化基本数值,返回一个method集合
 */
export default {

	init: function(bu) {
		var baseUrl = bu;

		return {
			/**
			 * 获取纪念日列表
			 * @method
			 * @param {Object} option Ajax参数
			 */
			getAnniversaryList : function(option) {
				// ajax(Object.assign({type:'get',url:baseUrl+'/getAnniversaryList'},option);
				mockAjax(option,[{ "id": 11, "title": "爸爸的生日", "start": "Fri Jun 07 00:00:00 CST 2017", anniversaryType: '1' }, { "id": 12, "title": "家庭日", "start": "Fri Jun 08 00:00:00 CST 2017", anniversaryType: '2' }, { "id": 13, "title": "结婚纪念日", "start": "Fri Jun 10 00:00:00 CST 2017", anniversaryType: '3' }, { "id": 13, "title": "其他纪念日", "start": "Fri Jun 09 00:00:00 CST 2017", anniversaryType: '4' }],100);
			},
			/**
			 * 获取纪念日信息
			 * @method
			 * @param {Object} option Ajax参数
			 */
			getAnniversary : function(option) {
				// ajax(Object.assign({type:'get',url:baseUrl+'/getAnniversary'},option);
				// 模拟
				mockAjax(option,{"id":11,"title":"爸爸的生日","start":"Fri Jun 07 00:00:00 CST 2017",'anniversaryType':'1','tip':true,"tipTime":'1','remark':'不能忘了','public':false},0);
			},
			/**
			 * 删除纪念日
			 * @method
			 * @param {Object} option Ajax参数
			 */
			deleteAnniversary : function(option) {
				// ajax(Object.assign({type:'post',url:baseUrl+'/deleteAnniversary'},option);
				// 模拟
				mockAjax(option,[],500);
			},
			/**
			 * 更新纪念日
			 * @method
			 * @param {Object} option Ajax参数
			 */
			updateAnniversary : function(option) {
				// ajax(Object.assign({type:'post',url:baseUrl+'/updateAnniversary'},option);
				// 模拟
				mockAjax(option,[],500);
			}
		}

	}

}
</code></pre>
        </article>
    </section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-components_appCalendar.html">components/appCalendar</a></li><li><a href="module-components_appLoading.html">components/appLoading</a></li><li><a href="module-components_appUserBox.html">components/appUserBox</a></li><li><a href="module-components_editImage.html">components/editImage</a></li><li><a href="module-components_fileList.html">components/fileList</a></li><li><a href="module-components_menuNava_menuNava.html">components/menuNava/menuNava</a></li><li><a href="module-components_menuNava_menuNavaItem.html">components/menuNava/menuNavaItem</a></li><li><a href="module-components_myInputPage.html">components/myInputPage</a></li><li><a href="module-components_mySelectPage.html">components/mySelectPage</a></li><li><a href="module-components_myWebuploader.html">components/myWebuploader</a></li><li><a href="module-components_textImgBox.html">components/textImgBox</a></li><li><a href="module-components_timeline_timeline.html">components/timeline/timeline</a></li><li><a href="module-components_timeline_timelineItem.html">components/timeline/timelineItem</a></li><li><a href="module-components_vImg.html">components/vImg</a></li><li><a href="module-scripts_common.html">scripts/common</a></li><li><a href="module-scripts_configValid.html">scripts/configValid</a></li><li><a href="module-scripts_LunarCalendar.html">scripts/LunarCalendar</a></li><li><a href="module-scripts_vueMethods.html">scripts/vueMethods</a></li><li><a href="module-services.html">services</a></li><li><a href="module-services_AnniversaryService.html">services/AnniversaryService</a></li><li><a href="module-services_ArchiveService.html">services/ArchiveService</a></li><li><a href="module-services_BigEventService.html">services/BigEventService</a></li><li><a href="module-services_FamilyService.html">services/FamilyService</a></li><li><a href="module-services_UserService.html">services/UserService</a></li><li><a href="module-vuex-history.html">vuex-history</a></li><li><a href="module-vuex-loading.html">vuex-loading</a></li><li><a href="module-vuex-toast.html">vuex-toast</a></li></ul><h3>Namespaces</h3><ul><li><a href="Vue.html">Vue</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri Jun 30 2017 09:20:36 GMT+0800 (中国标准时间)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
